<template>
        <el-table class="mt10 mb10" border ref="tableref" :data="listData" v-loading="isloading" :height="tableHeight">
          <slot name="main"></slot>
        </el-table>
</template>

<script>
  import {onMounted, toRef, toRefs, ref} from 'vue'
 // import getFullHeight from '@/utils/adpative-table.js'
  export default {
    name: "MTable",
    props: {
      tableData: {
        type: Object,
        default() {
          return {
            total: 0,
            listData: []
          }
        }
      },
      isloading: {
        type: Boolean,
        default: false
      }
    },
    setup(props) {
      const tableDataObj = toRef(props, 'tableData')
      const tableHeight=ref()
      const tableref=ref(null)
      onMounted( () => {
        tableHeight.value =
        window.innerHeight - tableref.value.$el.offsetTop - 80;
      })
      return {
        ...toRefs(tableDataObj.value),
        tableHeight,
        tableref
      }
    }
  }
</script>

<style scoped>
  .app {
    padding: 20px 20px 5px 20px;
  }
</style>
